package com.leo.train.business.mapper;

import com.github.pagehelper.Page;
import com.leo.train.business.dto.DailyTrainTicketDto;
import com.leo.train.business.entity.DailyTrainTicket;
import org.apache.ibatis.annotations.Mapper;

import java.util.Date;

@Mapper
public interface DailyTrainTicketMapper {
    /**
     * 新增
     * @param dailyTrainTicket
     */
    void insert(DailyTrainTicket dailyTrainTicket);

    /**
     * 修改
     * @param dailyTrainTicket
     */
    void update(DailyTrainTicket dailyTrainTicket);

    /**
     * 查询详情
     * @param id
     * @return
     */
    DailyTrainTicket detail(Long id);

    /**
     * 删除
     * @param id
     */
    void delete(Long id);

    /**
     * 查询列表
     * @param dailyTrainTicketDto
     * @return
     */
    Page<DailyTrainTicket> pageQuery(DailyTrainTicketDto dailyTrainTicketDto);

    /**
     * 删除某车次某天的所有余票
     * @param trainCode
     * @param date
     */
    void deleteByTrainCodeAndDate(String trainCode, Date date);

    /**
     * 查询某车次某天的余票记录
     * @param trainCode
     * @param date
     * @param start
     * @param end
     * @return
     */
    DailyTrainTicket selectByUnique(String trainCode, Date date, String start, String end);
}
